<template>
  <div class="infoSpread">
    <!-- 切换组件 -->
    <div class="spreadTab">
      <div
        v-for="(item, index) in tabList"
        class="tab-item"
        :class="{ 'active': index == currenrtIndex}"
        @click="setCurrent(index)"
        :key="index"
      >
        {{ item }}
      </div>
    </div>

    <!-- 展示组件 -->
    <div class="spreadCont">
      <el-col
        :span="8"
        v-for="(o, index) in 3"
        :key="o"
        :offset="index > 0 ? 1 : 0"
      >
        <el-card :body-style="{ padding: '0px' }">
          <img
            src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
            class="image"
          />
          <div style="padding: 14px">
            <span>好吃的汉堡</span>
            <div class="bottom clearfix">
              <time class="time">2020-08-12</time>
              <!-- <el-button type="text" class="button">操作按钮</el-button> -->
            </div>
          </div>
        </el-card>
      </el-col>
    </div>

    <!-- 换一批 -->
    <div class="changeSpread">
      <el-button plain>换一批</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      currenrtIndex: 0,
      tabList: ["科技", "医美", "生活", "房产"],
    };
  },
  methods: {
    setCurrent(index) {
      console.log(this.currenrtIndex)
      this.currenrtIndex = index;
    },
  },
};
</script>


<style scoped lang="less">
/* 主体 */
.infoSpread {
  width: 1200px;
  height: auto;
  overflow: hidden;
  margin: 0 auto;
  padding: 80px 0px;
  .spreadTab {
    width: 100%;
    height: auto;
    overflow: hidden;
    display: flex;
    justify-content: space-around;
    flex-wrap: nowrap;
    padding: 0 26%;
    box-sizing: border-box;
    margin-bottom: 60px;
    .tab-item {
      width: 100px;
      height: 35px;
      line-height: 35px;
      border: 1px solid #dedede;
      background-color: #f2f2f2;
      box-sizing: border-box;
      text-align: center;
      font-size: 14px;
      color: #545454;
      cursor: pointer;
      transition: 0.2s;
      &:hover {
        background-color: #e7e7e7;
      }
    }
    .active {
      background-color: #0099e5;
      color: #fff;
      border: 1px solid #0085c7;
      transition: 0.2s;
      &:hover {
        background-color: #0099e5;
      }
    }
  }
  .spreadCont {
    width: 100%;
    height: auto;
    overflow: hidden;
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    padding: 0 8%;
    box-sizing: border-box;
    margin-bottom: 0px;
  }
  .changeSpread {
    display: block;
    width: 100%;
    height: auto;
    padding: 40px 0px;
  }
}
.footerBar {
  position: fixed;
  bottom: 0;
}

.time {
  font-size: 13px;
  color: #999;
}

.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.button {
  padding: 0;
  float: right;
}

.image {
  width: 100%;
  display: block;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}
</style>
